package com.pinkmeet.socket;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpSession;
import javax.websocket.EndpointConfig;
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;

import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;

//import com.chat.common.HTMLFilter;
//import com.chat.controller.UserDAOImpl;
//import com.chat.entity.User;

//@ServerEndpoint(value = "/index.jsp",configurator=GetHttpSessionConfigurator.class)
public class ChatAnnotation {
    //日志对象
    private static final Log logger = LogFactory.getLog(ChatAnnotation.class);
    //
    private static final Map<String, ChatAnnotation> connection = new HashMap<String, ChatAnnotation>();

    private String userId;

    private String nickname;

    private Session session;

    public ChatAnnotation() {
    }


    @OnOpen
    //链接时触发
    public void onOpen(@PathParam("userId") String userId, Session session)throws IOException {
        this.userId = userId;
//        logger.debug("新连接：{}",userId);

    }

    @OnClose
    //链接关闭时调用
    public void onClose() {
    }


    @OnMessage
    //收到消息时调用的函数
    public void onMessage(String message){

    }


    @OnError
    //出错时调用的函数
    public void onError(Throwable t) throws Throwable {

    }


    //发送给指定的好友
    private static void toConfirmFriend(String msg,String uid) {

    }

    //给聊天的双发发共同消息
}
